<?php

namespace catchAdmin\smstag\tables;

use catcher\CatchTable;
use catchAdmin\smstag\tables\forms\Factory;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class SmsTag extends CatchTable
{
    public function table()
    {
        return $this->getTable('sms_tag')
            ->header([
                HeaderItem::label('编号')->prop('id'),
                HeaderItem::label('标签名称')->prop('title'),
                HeaderItem::label('对应字段')->prop('mapping_field'),
                HeaderItem::label('操作')->width(400)->actions([
                    Actions::update(),
                    Actions::delete(),
                ]),
            ])
            ->withSearch(
                [
                    Search::text("title", "标签名称"),
                    Search::text("mapping_field", "对应字段"),
                ])
            ->withActions([
                Actions::create(),

            ])->withHiddenPaginate()
            ->withDialogWidth('50%')
            ->withApiRoute('smstag/smsTag')

            ->render();

    }

    protected function form()
    {
        // TODO: Implement form() method.
        return Factory::create('smsTag');
    }

}